<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HelloWorld</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
  <h1>HelloWorld</h1>
  <hr>
  <div id="app">
    <component v-bind:is="who"></component>
    <button @click="change">change</button>
  </div>
  <script type="text/javascript">
  var componentA={
    template:`<div style="color:red">I'm componentA.</div>`
  }
  var componentB={
    template:`<div style="color:green">I'm componentB.</div>`
  }
  var componentC={
    template:`<div style="color:blue">I'm componentC.</div>`
  }
  var app = new Vue({
    el:'#app',
    data:{
      who:'componentA'
    },
    components:{
      "componentA":componentA,
      "componentB":componentB,
      "componentC":componentC,
    },
    methods:{
      change:function(){
        if(this.who == 'componentA'){
          this.who = 'componentB';
        }
        else if (this.who == 'componentB'){
          this.who = 'componentC';
        }
        else{
          this.who = 'componentA';
        }
      }
    }
  })
  </script>
</body>
</html>